import request from '@/utils/request'

// 获取导航分类列表
export function getNavList() {
  return request({
    url: '/navicategories',
    method: 'get'
  })
}

// 获取导航详情
export function getNavigationDetail(id) {
  return request({
    url: `/navigation/${id}`,
    method: 'get'
  })
}

// 获取导航对应内容
export function getNavContent() {
  return request({
    url: '/navigations',
    method: 'get'
  })
}

// 新建导航
export function createNavigation(params) {
  return request({
    url: '/navigation',
    method: 'post',
    data: params
  })
}

// 更新导航
export function updateNavigation(id, params) {
  return request({
    url: `/navigation/${id}`,
    method: 'put',
    data: params
  })
}

// 删除导航
export function deleteNavigation(id) {
  return request({
    url: `/navigation/${id}`,
    method: 'delete'
  })
}

// 上传logo
export function uploadLogo(params) {
  var formData = params
  return request({
    url: '/upload/navigation',
    method: 'post',
    'Content-Type': 'multipart/form-data',
    data: formData
  })
}

// 新建导航分类
export function createNavCategory(params) {
  return request({
    url: '/navicategory',
    method: 'post',
    data: params
  })
}

// 更新导航分类
export function updateNavCategory(id, params) {
  return request({
    url: `/navicategory/${id}`,
    method: 'put',
    data: params
  })
}

// 删除导航分类
export function deleteNavCategory(id) {
  return request({
    url: `/navicategory/${id}`,
    method: 'delete'
  })
}
